<?php
/**
 * 系统日志模型
 * @author GL
 * @date 2018.8.24
 */

namespace App\Model\Crm;

use App\model\BaseModel;
use DB;

class LogModel extends BaseModel{

    const LOG = 'log';
    const USER = 'user';

    //日志录入
    public static function insertLog($data = [])
    {
        return DB::table(self::LOG)->insert($data);
    }

    //日志读取
    public function getLogList($field = '*', $offset = '10')
    {
        return DB::table(self::LOG .' as log')
                ->leftJoin(self::USER .' as user', 'user.id', '=', 'log.user_id')
                ->orderBy('create_at','desc')
                ->select($field)
                ->paginate($offset);
    }
}